package com.xuecheng.api.cms;

import com.xuecheng.framework.domain.cms.CmsTemplate;
import com.xuecheng.framework.model.response.QueryResponseResult;
import com.xuecheng.framework.model.response.QueryResult;
import com.xuecheng.framework.model.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

@Api(value = "cms模板管理", tags = {"cms模板管理接口，提供增，删，改，查"})
public interface CmsTemplateControllerApi {
    /**
     * 查询所有的Cms模板信息
     * @return 查询出的结果封装成统一返回对象
     */
    @ApiOperation("查询所有的模板信息")
    QueryResponseResult findList();

    /**
     * @param page 第几页
     * @param size 每页显示多少
     * 分页查询所有的Cms模板信息
     * @return 查询出的结果封装成统一返回对象
     */
    @ApiOperation("分页查询所有的模板信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "第几页",required = true,paramType = "path"),
            @ApiImplicitParam(name = "size",value = "每页显示多少",required = true,paramType = "path")
    })
    QueryResponseResult findListByPagination(int page, int size);

    /**
     *上传模板文件
     * @param file 模板文件
     * @param templateName 模板文件名
     * @param templateParameter 模板参数
     * @param siteId 站点id
     * @return 响应结果
     */
    @ApiOperation("上传模板")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file",value = "模板文件",dataType = "file"),
            @ApiImplicitParam(name = "templateName",value = "模板文件名"),
            @ApiImplicitParam(name = "templateParameter",value = "模板参数"),
            @ApiImplicitParam(name = "siteId",value = "站点id")
    })
    ResponseResult uploadTemplate(MultipartFile file,String templateName,String templateParameter,String siteId);

    /**
     * 根据模板id删除模板
     * @param templateId 模板id
     * @return 操作响应
     */
    @ApiOperation("删除模板")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "templateId",value = "模板id",required = true, paramType = "path")
    })
    ResponseResult deleteTemplate(String templateId);

    /**
     * 根据模板id导出模板
     * @param templateId 模板id
     * @return 操作字节
     */
    @ApiOperation("根据模板id下载模板")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "templateId",value = "模板id",required = true, paramType = "path")
    })
    ResponseResult downTemplate(String templateId, HttpServletResponse httpServletResponse);

    /**
     *上传模板文件
     * @param file 模板文件
     * @param templateName 模板文件名
     * @param templateParameter 模板参数
     * @param siteId 站点id
     * @return 响应结果
     */
    @ApiOperation("更新模板信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "multipartFile",value = "模板文件",dataType = "file"),
            @ApiImplicitParam(name = "templateId",value = "模板id"),
            @ApiImplicitParam(name = "templateName",value = "模板文件名"),
            @ApiImplicitParam(name = "templateParameter",value = "模板参数"),
            @ApiImplicitParam(name = "siteId",value = "站点id")
    })
    ResponseResult updateTemplate(MultipartFile file,String templateId,String templateName,String templateParameter,String siteId);
}
